PYTHON=python
MANAGE=$(PYTHON) manage.py


default: help

dev:
	@export INHOUSEWEB_DEBUG=1; cd app; $(MANAGE) runserver

egg_info:
	@cd app; $(PYTHON) setup.py egg_info

help:
	@echo "Available commands:"
	@sed -n '/^[a-zA-Z0-9_.]*:/s/:.*//p' <Makefile | sort

fixture:
	@cd app; $(MANAGE) dumpdata inhouse --format=yaml --indent=4 > inhouse/fixtures/inhouse.yaml

js-compiled:
	@$(PYTHON) closure/closure/bin/calcdeps.py -i app/inhouse/static/js/script.js -p closure -o compiled -c compiler.jar > app/inhouse/static/js/script.js.compiled

js-compiled-optimized:
	@$(PYTHON) closure/closure/bin/calcdeps.py -i app/inhouse/static/js/script.js -p closure -o compiled -c compiler.jar -f "--compilation_level=ADVANCED_OPTIMIZATIONS" > app/inhouse/static/js/script.js.compiled

makemessages:
	@cd app/inhouse; $(PYTHON) ../manage.py makemessages -a

run:
	@cd app; $(MANAGE) runserver

sdist: egg_info
	@$(PYTHON) app/setup.py sdist

sprites:
	@rm static/img/sprites/sprites.zip
	@zip -Z bzip2 -j -v static/img/sprites/sprites.zip static/img/sprites/*.png

tests:
	@cd app; $(MANAGE) test inhouse
